package www.bw.com.controller;





import org.springframework.web.bind.annotation.*;
import www.bw.com.Service.MovieService;
import www.bw.com.entities.Movie;


import javax.annotation.Resource;

import java.util.List;


@RestController
@RequestMapping("/movie")

public class MovieController {

@Resource
private MovieService movieService;

//  static {
//    movies=Arrays.asList(
//      new Movie(1,"西虹市首富","吴有朋",90,new Date(),90,"爱情",2018,"中国",1),
//      new Movie(2,"西虹市首富","吴有朋",90,new Date(),90,"爱情",2018,"中国",1),
//      new Movie(3,"西虹市首富","吴有朋",90,new Date(),90,"爱情",2018,"中国",1)
//
//    );
//  }
          @GetMapping
  public List<Movie> list(@RequestParam(value = "cpage", defaultValue = "1") Integer cpage, @RequestParam(value = "row", defaultValue = "3") Integer row){

            //查看总条数
            Integer total = movieService.selectCount();
           List<Movie> movies=movieService.list();
            int index = (cpage - 1) * row;

            return movies.subList(index, index + row);

          }



}
